# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=tmuxinator
pkgver=3.0.5
pkgrel=6
pkgdesc="manage complex tmux sessions easily"
url="https://github.com/tmuxinator/tmuxinator"
arch="noarch"
license="MIT"
depends="ruby ruby-erubi ruby-thor ruby-xdg"
checkdepends="ruby-rspec"
options="!check" # requires coveralls
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/tmuxinator/tmuxinator/archive/v$pkgver/tmuxinator-$pkgver.tar.gz
	replace-erubis-with-erubi.patch
	tmuxinator-use-new-xdg-version.patch
	tmuxinator-support-tmux-3.4.patch
	"

build() {
	gem build tmuxinator.gemspec
}

check() {
	rspec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		tmuxinator

	install -Dm0644 completion/tmuxinator.bash \
		"$pkgdir"/usr/share/bash-completion/completions/tmuxinator
	install -Dm0644 completion/tmuxinator.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/tmuxinator.fish
	install -Dm0644 completion/tmuxinator.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_tmuxinator

	rm -r "$gemdir"/cache \
		"$gemdir"/extensions \
		"$gemdir"/doc \
		"$gemdir"/gems/tmuxinator-$pkgver/spec
}

sha512sums="
fa40c243499bee4baab4f0c5c35de79287721056f27fc691706ae60e24d159261ba7359b6a66decf57a9a5bd5d05b4b84248a468752dd93f3886f3b894303b45  tmuxinator-3.0.5.tar.gz
a05d992bd791de1b75708c146fe44a4ee8ab690cdf45ef564afa67eb114e7beda2f52db3a100af6d553e3721fc7a1d95bc3ef1b8023d7252aedb44e4e0312b5e  replace-erubis-with-erubi.patch
177befcccb158f1e385fcc5adf547654e4c69f5a4816fe6e2faaf6523dab069c0fbeed6c4eed22f6f061021161d1928d5df5f2f7060556c6e2ede39966781da7  tmuxinator-use-new-xdg-version.patch
d864a32c8d657df8f23cc82a97a822721d08325336e5fa5de0f4e3b2994a51a24db634b9cf74dad627b369438c47cb6601e284c95809cf56f9f58205b9603657  tmuxinator-support-tmux-3.4.patch
"
